<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>统一地图平台</title><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <style>
        html,
        body,
        #mapui {
            width: 100%;
            height: 100%;
        }

        html,
        body {
            margin: 0;
            padding: 0;
        }
    </style>
</head>

<body>
    <div id="mapui"></div>

    <script src="./js_example/script/map.min.js"></script>
    <script src="./js_example/script/demo.js"></script>
    <script src="./js_thematic_map_example/script/jq/jquery.min.js"></script>
    <script>
        var amap = null;
        var that = this;
        map.Factory.create('mapui', {
            center: [106.17609405517578, 35.41583177128595],
            fullExtent: {
                xmin: 90.992204,
                ymin: 10.979711,
                xmax: 120.5338915,
                ymax: 50.543712
            },
            zoom: 3,
            projection: 'EPSG:4326',
            strategy: ['mapboxgl', 'openlayers'],
            style: style
        }, (o) => {
            amap = o;
            map.Factory.loadSpecialMap('mapv' , () =>{
                that.init(amap);
            })
        });


        function init(map) {
            $.get('./js_thematic_map_example/data/weibo.json', function (rs) {
                console.log(rs);
                var data1 = [];
                var data2 = [];
                var data3 = [];
                var data4 = [];
                for (var i = 0; i < rs[0].length; i++) {
                    var geoCoord = rs[0][i].geoCoord;
                    data1.push({
                        geometry: {
                            type: 'Point',
                            coordinates: geoCoord
                        }
                    });
                }

                for (var i = 0; i < rs[1].length; i++) {
                    var geoCoord = rs[1][i].geoCoord;
                    data2.push({
                        geometry: {
                            type: 'Point',
                            coordinates: geoCoord
                        },
                        time: Math.random() * 10
                    });
                }

                for (var i = 0; i < rs[2].length; i++) {
                    var geoCoord = rs[2][i].geoCoord;
                    data3.push({
                        geometry: {
                            type: 'Point',
                            coordinates: geoCoord
                        },
                    });
                }

                var dataSet = new special_mapv.DataSet(data1);
                var options = {
                    fillStyle: 'rgba(200, 200, 0, 0.8)',
                    bigData: 'Point',
                    size: 0.7,
                    draw: 'simple',
                }
                
                var mapvLayer = new special_mapv.FmLayer(map, dataSet, options);

                var dataSet = new special_mapv.DataSet(data2);
                var options = {
                    fillStyle: 'rgba(255, 250, 0, 0.8)',
                    size: 0.7,
                    bigData: 'Point',
                    draw: 'simple',
                }
                var mapvLayer = new special_mapv.FmLayer(map, dataSet, options);

                var dataSet = new special_mapv.DataSet(data3);
                var options = {
                    fillStyle: 'rgba(255, 250, 250, 0.6)',
                    size: 0.7,
                    bigData: 'Point',
                    draw: 'simple',
                }
                var mapvLayer = new special_mapv.FmLayer(map, dataSet, options);

                var dataSet = new special_mapv.DataSet(data2);
                var options = {
                    fillStyle: 'rgba(255, 250, 250, 0.9)',
                    size: 1.1,
                    draw: 'simple',
                    bigData: 'Point',
                    animation: {
                        stepsRange: {
                            start: 0,
                            end: 10
                        },
                        trails: 1,
                        duration: 6,
                    }
                }

                var mapvLayer = new special_mapv.FmLayer(map, dataSet, options);
            });
        }
    </script>
</body>

</html>